//package com.jeremyfeinstein.utils;
//
//import javax.crypto.Cipher;
//import javax.crypto.SecretKey;
//import javax.crypto.SecretKeyFactory;
//import javax.crypto.spec.DESedeKeySpec;
//
//import sun.misc.BASE64Decoder;
//import sun.misc.BASE64Encoder;
//
//
//@SuppressWarnings({ "restriction" })
//public class ThreeDESEncryptionUtil {
//
//	// 3DESECB加密,key必须是长度大于等于 3*8 = 24 位哈
//	public String encryptThreeDESECB(final String src, final String s)
//			throws Exception {
//		final DESedeKeySpec dks = new DESedeKeySpec(s.getBytes("UTF-8"));
//		final SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
//		final SecretKey securekey = keyFactory.generateSecret(dks);
//
//		final Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
//		cipher.init(Cipher.ENCRYPT_MODE, securekey);
//		final byte[] b = cipher.doFinal(src.getBytes());
//
//		final BASE64Encoder encoder = new BASE64Encoder();
//		return encoder.encode(b).replaceAll("\r", "").replaceAll("\n", "");
//
//	}
//
//	// 3DESECB解密,key必须是长度大于等于 3*8 = 24 位哈
//	public byte[] decryptThreeDESECB(final String src, final String s)
//			throws Exception {
//		// --通过base64,将字符串转成byte数组
//		final BASE64Decoder decoder = new BASE64Decoder();
//		final byte[] bytesrc = decoder.decodeBuffer(src);
//		// --解密的key
//		final DESedeKeySpec dks = new DESedeKeySpec(s.getBytes("UTF-8"));
//		final SecretKeyFactory keyFactory = SecretKeyFactory
//				.getInstance("DESede");
//		final SecretKey securekey = keyFactory.generateSecret(dks);
//
//		// --Chipher对象解密
//		final Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
//		cipher.init(Cipher.DECRYPT_MODE, securekey);
//		return  cipher.doFinal(bytesrc);
//	}
//
//
//}
